<cfoutput>
	<cfset worksheetID = $.request.getValue('worksheetID') />
	<cfset date = $.request.getValue('date') />
	<cfif date eq "">
		<cfset date = $.date.getDate() />
	</cfif>
	
	<cfset business = $.run.it('craftivityService.getBusiness',{userID=request.session.user.id}) />
	<cfset options = $.run.it('optionService.getOptions',{key='calendar'}) />

	<cfsavecontent variable="page">
		<script>
			$(document).ready(function(){
				Calendar.init();
			});
		</script>

		<cfif options.refresh_token neq "">
			#$.render.form(name='refresh_calendar',method='calendarController.refreshGoogleCalendar')#
				<input type="hidden" name="date" value="#date#" />
			</form>
		</cfif>

		<div class="header variable-width">
			<i class="fa fa-home" onclick="Main.nav('home');"></i>
			<cfif options.refresh_token neq "">
				<i class="fa fa-gears" onclick="Main.toggleOptions('calendar');"></i>
			</cfif>
			
			#$.run.it('calendarView.renderGoogleRefresh')#
			
			<div class="header-title">Calendar</div>

			#$.render.img(path="craftivity/widget_icons/calendar.png",class="title_logo")#</br>
			
			<cfif options.refresh_token eq "">
				#$.render.form(name='connect_calendar',method='calendarController.connectGoogleCalendar')#
					<input type="hidden" name="date" value="#date#" />
					#$.render.img(path='craftivity/nothing.png',class="google_connect",onclick="Calendar.connectGoogleCalendar();")#
				</form>
			</cfif>
		</div>
		
		<div class="notification-area timeline">
			<div class="timeline-container">
				#$.run.it("calendarView.renderTimeline",{date=date})#
			</div>
			#$.run.it("calendarView.renderTimelineControls",{date=date})#
		</div>
		
		<!--- display info about running threads --->
		#$.run.it("calendarView.renderGoogleSyncStatus")#

		#$.run.it("optionView.renderOption",{key="calendar"})#
		
		<cfif business.timezone eq "">
			#$.run.it('setupView.renderCalendarSetup')#
			<script>
				$(document).ready(function(){
					Calendar.hasTimezone = false;
				});
			</script>
		<cfelse>
			#$.run.it("calendarView.renderCalendarDays",{date=date})#
		</cfif>
		
	</cfsavecontent>
	
	#$.run.it("craftivityView.renderPage",{centerContent=page})#
</cfoutput>